|
In computing and systems design a loosely coupled system is one in which each of its components has, or makes use of, little or no knowledge of the definitions of other separate components. Sub-areas include the coupling of classes, interfaces, data, and services. == In computing == Coupling refers to the degree of direct knowledge that one component has of another. This is meant to be interpreted as encapsulation vs. non-encapsulation. An example of tight coupling occurs when a dependent class contains a pointer directly to a concrete class which provides the required behavior. The dependency cannot be substituted, or its "signature" changed, without requiring a change to the dependent class. Loose coupling occurs when the dependent class contains a pointer only to an interface, which can then be implemented by one or many concrete classes. The dependent class's dependency is to a "contract" specified by the interface; a defined list of methods and/or properties that implementing classes must provide. Any class that implements the interface can thus satisfy the dependency of a dependent class without having to change the class. This allows for extensibility in software design; a new class implementing an interface can be written to replace a current dependency in some or all situations, without requiring a change to the dependent class; the new and old classes can be interchanged freely. Strong coupling does not allow this. This is a UML diagram (created in IBM Rhapsody) illustrating an example of ''loose'' coupling between a dependent class and a set of concrete classes, which provide the required behavior: File:Loose Coupling Example.JPG For comparison, this diagram illustrates the alternative design with ''strong'' coupling between the dependent class and a provider: File:Strong Coupling Example.JPG 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「loose coupling」の詳細全文を読む スポンサード リンク
|